<?php

use common\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\select2\Select2;
use common\enums\StatusEnum;



$this->title = '审核';
$this->params['breadcrumbs'][] = ['label' => '档案管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;


?>

<div class="row">
    <div class="col-lg-12">
        <div class="box">
            <div class="box-header with-border">
                <h3 class="box-title">基本信息</h3>
            </div>
            <div class="box-body">
                <?php $form = ActiveForm::begin([
                    'fieldConfig' => [
//                        'template' => "<div class='col-sm-1 text-right'>{label}</div><div class='col-sm-11'>{input}\n{hint}\n{error}</div>",
                    ],
                ]); ?>
                <div class="col-sm-12">
                    <ul class="timeline">
                        <li class="time-label">
                          <span class="bg-blue">
                            审核开始
                          </span>
                        </li>
                        <?php
                        foreach ($model->log ?? [] as $log) {
                            $log = json_decode($log);
                            ?>
                            <li>
                                <i class="fa fa-user bg-blue"></i>
                                <div class="timeline-item">
                                    <span class="time"><i class="fa fa-clock-o"></i> <?= date("Y-m-d H:i:s", $log->time) ?></span>
                                    <h3 class="timeline-header"><?= $log->name ?> <?= \addons\Flow\common\enums\WorkflowEnum::getValue(explode('/', $log->action)[1]) ?></h3>
                                    <div class="timeline-body">
                                        <?= $log->suggest?>
                                    </div>
                                </div>
                            </li>
                            <?php
                        }
                        ?>

                        <?php if ($model->state == 'refused' || $model->state == 'approve') { ?>
                            <li class="time-label">
                              <span class="bg-yellow">
                                审核结束
                              </span>
                            </li>
                        <?php } else { ?>
                            <li>
                                <i class="fa fa-clock-o bg-gray"></i>
                            </li>
                        <?php } ?>
                    </ul>
                    <?php if (!($model->state == 'refused' || $model->state == 'approve')) { ?>
                        <hr>
                        <?= $form->field($model, 'status')->radioList($radioList)->label(false) ?>
                        <?= $form->field($model, 'suggest')->textInput(['placeholder' => '请填写审核意见'])->label(false) ?>
                    <?php } ?>
                </div>
                <?php if (!($model->state == 'refused' || $model->state == 'approve')) { ?>
                <div class="form-group">
                    <div class="col-sm-12 text-center">
                        <button class="btn btn-primary" type="submit">保存</button>
                        <span class="btn btn-white" onclick="history.go(-1)">返回</span>
                    </div>
                </div>
                <?php } ?>
                <?php ActiveForm::end(); ?>
            </div>
        </div>
    </div>
</div>
